package name.wilbur.course.db.bigone.model;
/**
 * @author wilbur
 */

import java.sql.Timestamp;

public class Article extends BaseDBModel {
	private int articleAuthorID;
	private String articleTitle;
	private String articleContent;
	private Timestamp articleCreateTime;
	private Timestamp articleModifyTime;
	
	public Article() {
	}

	public Article(int articleAuthorID, String articleTitle, String articleContent,
			Timestamp articleCreateDate, Timestamp articleModifyDate) {
		super();
		this.articleAuthorID = articleAuthorID;
		this.articleTitle = articleTitle;
		this.articleContent = articleContent;
		this.articleCreateTime = articleCreateDate;
		this.articleModifyTime = articleModifyDate;
	}

	public int getArticleAuthorID() {
		return articleAuthorID;
	}

	public void setArticleAuthorID(int articleAuthorID) {
		this.articleAuthorID = articleAuthorID;
	}

	public String getArticleTitle() {
		return articleTitle;
	}

	public void setArticleTitle(String articleTitle) {
		this.articleTitle = articleTitle;
	}

	public String getArticleContent() {
		return articleContent;
	}

	public void setArticleContent(String articleContent) {
		this.articleContent = articleContent;
	}

	public Timestamp getArticleCreateTime() {
		return articleCreateTime;
	}

	public void setArticleCreateTime(Timestamp articleCreateTime) {
		this.articleCreateTime = articleCreateTime;
	}

	public Timestamp getArticleModifyTime() {
		return articleModifyTime;
	}

	public void setArticleModifyTime(Timestamp articleModifyTime) {
		this.articleModifyTime = articleModifyTime;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = super.hashCode();
		result = prime * result + articleAuthorID;
		result = prime * result
				+ ((articleContent == null) ? 0 : articleContent.hashCode());
		result = prime
				* result
				+ ((articleCreateTime == null) ? 0 : articleCreateTime
						.hashCode());
		result = prime
				* result
				+ ((articleModifyTime == null) ? 0 : articleModifyTime
						.hashCode());
		result = prime * result
				+ ((articleTitle == null) ? 0 : articleTitle.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (!super.equals(obj))
			return false;
		if (getClass() != obj.getClass())
			return false;
		Article other = (Article) obj;
		if (articleAuthorID != other.articleAuthorID)
			return false;
		if (articleContent == null) {
			if (other.articleContent != null)
				return false;
		} else if (!articleContent.equals(other.articleContent))
			return false;
		if (articleCreateTime == null) {
			if (other.articleCreateTime != null)
				return false;
		} else if (!articleCreateTime.equals(other.articleCreateTime))
			return false;
		if (articleModifyTime == null) {
			if (other.articleModifyTime != null)
				return false;
		} else if (!articleModifyTime.equals(other.articleModifyTime))
			return false;
		if (articleTitle == null) {
			if (other.articleTitle != null)
				return false;
		} else if (!articleTitle.equals(other.articleTitle))
			return false;
		return true;
	}
	
	public String toString() {
		return articleTitle;
	}
}
